package modifyx

import "sync"

var (
	typeCreator = map[string]func(object IObject) IObject{}
	mutex       sync.RWMutex
)

func RegisterType(name string, creator func(object IObject) IObject) {
	mutex.Lock()
	typeCreator[name] = creator
	mutex.Unlock()
}

func getType(name string) func(object IObject) IObject {
	mutex.RLock()
	creator := typeCreator[name]
	mutex.RUnlock()
	return creator
}
